#ifndef __UART_H_
#define __UART_H_

#include "stm32f1xx_hal.h"


#define DEBUG_RX_BUF_SIZE			128
#define BLUETOOTH_RX_BUF_SIZE		128
#define BACKUP_RX_BUF_SIZE			128

typedef enum
{
	UART_CHANNEL_DEBUG 		= 0 ,
	UART_CHANNEL_BLUETOOTH	= 1 ,
	UART_CHANNEL_BACKUP		= 2 ,
	UART_CHANNEL_NUM		= 3
}UART_CHANNEL_EU;

typedef struct
{
	unsigned short rx_size ;
	unsigned short rx_in , rx_out;
    unsigned int   last_recv_time ; 
	unsigned char  *rx_buf;
    UART_HandleTypeDef *    husart ;
}UART_CHAN_T;

extern UART_CHAN_T uart_chan[UART_CHANNEL_NUM]; 


extern void uart_chan_init(void);
extern bool UART_Rx_Empty(unsigned char chan);
extern bool Uart_Get_Char(uint8_t chan, uint8_t *ptr);
extern unsigned int Uart_Get_Last_Recv_Time(unsigned char chan) ;

#endif

